package com.zjzywl.iotSendthings.repository;

import java.util.List;


import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.zjzywl.iotSendthings.entity.WPJSZPB;

@Repository
public interface InsertWPJSZPBRepository extends JpaRepository<WPJSZPB,String> {
	@Transactional
	@Query(value = "delete from wpjszpb where zpzybh=:zpzybh ", nativeQuery = true) 
	@Modifying
	void del(@Param("zpzybh")String zpzybh);
	@Query("select u from WPJSZPB u where u.uuid=:uuid ")
	List<WPJSZPB> findByUuid(@Param("uuid")String uuid);
	@Query(value="select zpzybh from WPJSZPB order by id DESC limit  1",nativeQuery=true)
	String findZyzybh();
	@Query("select u from WPJSZPB u where u.uuid=:uuid  and u.xh=:xh")
	List<WPJSZPB> getImg(@Param("uuid")String uuid, @Param("xh")String xh);
	@Query("select u from WPJSZPB u where u.uuid=:uuid")
	List<WPJSZPB> getImgNum(@Param("uuid")String uuid);
	@Modifying
	@Transactional
	@Query("update WPJSZPB u set u.xh=:xh where u.uuid=:uuid AND u.zpzybh=:zpzybh ")
	void updataBz(@Param("zpzybh")String zpzybh, @Param("uuid")String uuid,  @Param("xh")String xh);
}
